/*
 * This file is part of Dorado 7.x (http://dorado7.bsdn.org).
 * 
 * Copyright (c) 2002-2012 BSTEK Corp. All rights reserved.
 * 
 * This file is dual-licensed under the AGPLv3 (http://www.gnu.org/licenses/agpl-3.0.html) 
 * and BSDN commercial (http://www.bsdn.org/licenses) licenses.
 * 
 * If you are unsure which license is appropriate for your use, please contact the sales department
 * at http://www.bstek.com/contact.
 */

function setUpPage() {
	Test.preloadAsyncTests([AsyncActionChanged]);
}

var AsyncActionChanged = {
	load: function() {
		Test.asyncProcBegin("AsyncActionChanged");
		TestActionButton = $extend([dorado.widget.Control, dorado.widget.ActionSupport], {
			refreshCounter: 0,
			
			onActionStateChanged: function() {
				this.refreshCounter++;
				Test.asyncProcEnd("AsyncActionChanged");
			}
		});
		
		var action = this.action = new dorado.widget.Action();
		
		this.button = new TestActionButton({
			action: action
		});
		action.set("label", "label1");
		action.set("icon", "icon1");
	},
	
	run: function() {
		assertEquals(1, this.button.refreshCounter);
	}
};

function testAsyncActionChanged() {
	AsyncActionChanged.run();
}
